﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dblayer;
using Modellayer;

namespace ControlLayer
{
    public class MovieCtr
    {
        DbMovie dbMovie;
        public static MovieCtr instance;

        private MovieCtr()
        {
           dbMovie = new DbMovie();
        }

        public static MovieCtr getInstance()
        {
            if (instance == null)
            {
                instance = new MovieCtr();
            }
            return instance;

        }

        public void createMovie(string title, string movieLength)
        {
           Movie movie = new Movie(title, movieLength);
           dbMovie.createMovie(movie);
        }

        public void updateMovie(string title, string movieLength, string description)
        {
           Movie movie = new Movie(title, movieLength);
           movie.Description = description;
           dbMovie.updateMovie(movie);
        }

        public Movie findMovie(string title)
        {
            return dbMovie.findMovie(title);
        }

        public void deleteMovie(string title)
        {
           dbMovie.deleteMovie(title);
        }

        public List<Movie> findAllMovies()
        {
            return dbMovie.findAllMovies();
        }
    }
}
